import { createSlice } from "@reduxjs/toolkit";

const shopSlice = createSlice({
    name: 'shop-slice',
    initialState: {
        shopList: [
            {
                name: 'xiaomi 15',
                price: '3999',
                id: 1
            }
        ]
    },
    reducers: {
        setName: (state, action) => {
            state.shopList[0].name = action.payload;
        },
        setPrice: (state, action) => {
            state.shopList[0].price = action.payload;
        }
    }
});

export const { setName, setPrice } = shopSlice.actions;
export default shopSlice.reducer;
